package com.li.service.impl;

import com.li.exception.NotFondException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.li.domain.FileAddress;
import com.li.mapper.FileAddressMapper;
import com.li.service.FileAddressService;
@Service
public class FileAddressServiceImpl extends ServiceImpl<FileAddressMapper, FileAddress> implements FileAddressService{

    @Autowired
    private FileAddressMapper fileAddressMapper;

    @Override
    public List<FileAddress> listPageFileAddress(FileAddress fileAddress, Integer page, Integer limit) {
        Integer indexPage=(page-1)*limit;
        return fileAddressMapper.listPageFileAddress(fileAddress,indexPage,limit);
    }

    @Override
    public Integer listPageFileAddressCount(FileAddress fileAddress) {
        return fileAddressMapper.listPageFileAddressCount(fileAddress);
    }

    @Override
    public void addSystemAddress(FileAddress fileAddress) {
        if (fileAddress==null){
            new NotFondException("为空");
        }
        fileAddress.setCreateTime(new Date());
        fileAddressMapper.insert(fileAddress);
    }

    @Override
    public void updateSystemAddress(FileAddress fileAddress) {
        if (fileAddress==null){
            new NotFondException("为空");
        }
        fileAddress.setUpdateTime(new Date());
        fileAddressMapper.updateById(fileAddress);
    }

}
